import { http } from "@/utils/http";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

//查询指标
export const emissionIndicatorquery = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicator/query`, {
    data
  });
};
//新增指标
export const emissionIndicatorsave = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicator/save`, {
    data
  });
};
//修改指标
export const emissionIndicatoredit = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicator/edit`, {
    data
  });
};
//删除指标
export const emissionIndicatordelete = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicator/delete`, {
    data
  });
};
//查看指标详情
export const emissionIndicatordetail = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicator/detail`, {
    data
  });
};
// 四则运算符号下拉框
export const emissionIndicatorgetOperator = (params: object | undefined) =>
  http.request(
    "get",
    `/energy/emissionIndicator/getOperator`,
    { params },
    {
      headers: { noLoading: false }
    }
  );

//查询指标台账列表
export const emissionIndicatorLedgerlistLedgel = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicatorLedger/listLedge`, {
    data
  });
};

//根据指标ID重算计算结果
export const emissionIndicatorLedgercalculate = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicatorLedger/calculate`, {
    data
  });
};

//根据指标ID删除
export const emissionIndicatorLedgerdeleteLedge = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicatorLedger/deleteLedge`, {
    data
  });
};

//计算历史记录
export const emissionIndicatorLedgerlistHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicatorLedger/listHistory`, {
    data
  });
};

//关联异常原因
export const consumptionMonitorlistAlarm = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/consumptionMonitor/listAlarm`, {
    data
  });
};

//alarm列表
export const emissionIndicatorLedgerlinkAlarm = (data?: object) => {
  return http.request<ResultTable>("post", `/energy/emissionIndicatorLedger/linkAlarm`, {
    data
  });
};
